<?php
	ob_end_flush();
	if ($action['xpath']) {
		$targets = $xpath->query($action['xpath']);
	} else {
		$targets = array($tag);
	}

	
	foreach($targets as $target) {
		$newNode = $dom->createDocumentFragment();
		$newNode->appendXML($this->php2cdata('<?$this->vars[strtoupper("'.$action['var'].'")] = "'.$target->getAttribute($action['attr']).'";?>'));
		$target->parentNode->insertBefore($newNode, $target);
	}
?>